package org.yoshiori.lingr.api.vo;

/**
 * @author yoshiori
 * 
 */
public enum MessageType {
	USER("user"), 
	SYSTEM_ENTER("system:enter"), 
	SYSTEM_NICKNAME_CHANGE("system:nickname_change"), 
	SYSTEM_LEAVE("system:leave");

	private String typeName;

	/**
	 * @param typeName
	 */
	private MessageType(String typeName) {
		this.typeName = typeName;
	}

	/**
	 * @param type
	 * @return
	 */
	public static MessageType lookup(String type) {
		for (MessageType messageType : values()) {
			if (messageType.toString().equals(type)) {
				return messageType;
			}
		}
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Enum#toString()
	 */
	@Override
	public String toString() {
		return typeName;
	}

}
